package club.twelveblog.tblog.utils;

import org.springframework.web.multipart.MultipartFile;

import java.util.Date;

public class ReNameImage {
    public static String renameFile(MultipartFile file){
        //获取图片原始文件名
        String filename = file.getOriginalFilename();
        //重新命名文件
        String suffix = filename.substring(filename.lastIndexOf(".") + 1);
        String fileName = new Date().getTime() + "_img." + suffix;
        return fileName;
    }
}
